package com.baosight.sczx.zm.ca.service;

import java.util.Calendar;

import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.ep.ServiceEPBase;
import com.baosight.sczx.common.zm.Utils;
import com.baosight.sczx.zm.ca.domain.VZMCA23;

public class ServiceZMCA22 extends ServiceEPBase{
	
	/**
	 * 页面初始化，返回组织好的层级小代码
	 * 
	 * @param EiInfo
	 * @return EiInfo
	 */
	public EiInfo initLoad(EiInfo inInfo) {
		return inInfo;//return this.query(inInfo);
	}

	public EiInfo queryByTrend(EiInfo inInfo) {
		VZMCA23 daoBean = new VZMCA23();
		
		//各个指标的权重
		inInfo.addBlock(Utils.generateOutBlock("config", daoBean, inInfo, "ZMCA23.queryConfig", false));	
		//安全问题数量
		inInfo.addBlock(Utils.generateOutBlock("securityCount", daoBean, inInfo, "ZMCA23.querySecCountByTrend", false));	
		//生产问题数量
		inInfo.addBlock(Utils.generateOutBlock("produceCount", daoBean, inInfo, "ZMCA23.queryProCountByTrend", false));	
		//生产计划偏差率
		inInfo.addBlock(Utils.generateOutBlock("producePlanRate", daoBean, inInfo, "ZMCA23.queryProRateByTrend", false));	
		//材料计划超节率
		inInfo.addBlock(Utils.generateOutBlock("materialPlanRate", daoBean, inInfo, "ZMCA23.queryMatRateByTrend", false));	
	
		Calendar currentTime = Calendar.getInstance(); 
		inInfo.set("month", ""+(currentTime.get(Calendar.MONTH) + 1));
		inInfo.set("year", ""+currentTime.get(Calendar.YEAR));		
			
		return inInfo;
	}
	
	public EiInfo queryByDepartment(EiInfo inInfo) {
		VZMCA23 daoBean = new VZMCA23();	
		
		//各个指标的权重
		inInfo.addBlock(Utils.generateOutBlock("config", daoBean, inInfo, "ZMCA23.queryConfig", false));	
		//安全问题数量
		inInfo.addBlock(Utils.generateOutBlock("securityCount", daoBean, inInfo, "ZMCA23.querySecCountByDepartment", false));	
		//生产问题数量
		inInfo.addBlock(Utils.generateOutBlock("produceCount", daoBean, inInfo, "ZMCA23.queryProCountByDepartment", false));	
		//生产计划偏差率
		inInfo.addBlock(Utils.generateOutBlock("producePlanRate", daoBean, inInfo, "ZMCA23.queryProRateByDepartment", false));	
		//材料计划超节率
		inInfo.addBlock(Utils.generateOutBlock("materialPlanRate", daoBean, inInfo, "ZMCA23.queryMatRateByDepartment", false));	
	
		Calendar currentTime = Calendar.getInstance(); 
		inInfo.set("month", ""+(currentTime.get(Calendar.MONTH) + 1));
		inInfo.set("year", ""+currentTime.get(Calendar.YEAR));		
			

		
		
		
		return inInfo;
	}
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
}
